package com.mca.framework.functinalInterface;

import com.mca.framework.lambda.Student;
import com.mca.framework.lambda.StudentService;

import java.util.List;

/**
 * @Author: zhoupeng
 * @createTime: 2025年07月14日 22:11:53
 * @version: 1.0
 * @Description:
 * @copyright:
 */
public class StudentSexServiceImpl  implements StudentService {
    @Override
    public Student getStudentInfo(List<Student> studentList, Student student) {

        for (Student s : studentList) {
            if (s.getSex().equals(student.getSex())){
                return s;
            }
        }
        return null;
    }


    public static void main(String[] args) {

        StudentService studentService = new StudentService() {

            @Override
            public Student getStudentInfo(List<Student> studentList, Student student) {

                for (Student s : studentList) {
                    if (s.getName().equals(student.getName())){
                        return s;
                    }

                    if (s.getSex().equals(student.getSex())){
                        return s;
                    }
                }
                return null;
            }
        };
    }
}
